<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>mustache源码解析</title>
</head>
<body>
    <div id="container"></div>

    <script src="/xuni/bundle.js"></script>
    <script>
      let templateStr = `
           <div>
                <ul>
                    {{#students}}
                    <li>
                        学生{{name}}的爱好是
                        <ol>
                            {{#hobbies}}
                            <li class="col">{{.}}</li>
                            {{/hobbies}}
                        </ol>
                    </li>
                    {{/students}}
                </ul>
            </div>
      `
      let data = {
        students: [
          {name: '小明', hobbies: ['游泳', '健身']},
          {name: '小黑', hobbies: ['篮球', '羽毛球']},
          {name: '小强', hobbies: ['吃饭', '睡觉']}
        ]
      }
      /*let templateStr = '我喜欢吃{{food}}，我考了{{a.b.c}}分'
      let data = {
        food: '肉',
        a: {
          b: {
            c: 100
          }
        }
      }*/
      let domStr = templateEngine.render(templateStr, data)

      let container = document.getElementById('container')
      container.innerHTML = domStr
    </script>
</body>
</html>